import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { Button,Input,Container,Header,Aside,Main,Menu,MenuItemGroup,Submenu,MenuItem,Table,TableColumn,Select,Option,Pagination,Dialog,Form,FormItem,DatePicker,Notification,Popconfirm,Steps,Step,Loading } from 'element-ui';
//yebo 引入layout布局
import {Row,Col,Drawer,Tree,Switch,Transfer,Dropdown,Tabs,TabPane,Collapse,CollapseItem,MessageBox,Message,Tag,Radio,RadioGroup,RadioButton} from 'element-ui';
Vue.use(Button)
Vue.use(Input)
Vue.use(Container)
Vue.use(Header)
Vue.use(Aside)
Vue.use(Main)
Vue.use(Menu)
Vue.use(MenuItemGroup)
Vue.use(Submenu)
Vue.use(MenuItem)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Select)
Vue.use(Option)
Vue.use(Pagination)
Vue.use(Dialog)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(DatePicker)
Vue.use(Popconfirm)
Vue.use(Steps)
Vue.use(Step)
Vue.use(Loading)
Vue.use(Row);
Vue.use(Col);
Vue.use(Drawer);
Vue.use(Tree);
Vue.use(Switch);
Vue.use(Transfer);
Vue.use(Dropdown);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Collapse);
Vue.use(CollapseItem);
Vue.use(Tag);
Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(RadioButton);
// Vue.use(Alert);
// Vue.use(Notification)
// Vue.use(RadioGroup)
// Vue.use(RadioButton)
// 123123

Vue.prototype.$Alert=Notification
// Vue.prototype.$loading=Loading
//yebo 2023-06-25
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$message = Message;
Vue.prototype.$confirm = MessageBox.confirm;

Vue.config.productionTip = false


router.beforeEach((to,from,next)=>{
  // console.log(sessionStorage.getItem("userName"))
  if(to.meta.requireAuth){
    if(sessionStorage.getItem("userName") !== null){
      next();
    }else{
      alert('您还没有登录，请先登录');
      next('/');
    }
  }else{
    next()
  }
})



new Vue({
  router,
  store,
  render: h => h(App),
  beforeCreate(){
    Vue.prototype.$bus=this
  }
}).$mount('#app')
